{
	arguments: {
		title: '<?=$_POST['title']; ?>',
		description: '<?=str_replace("\n", "\\n", $_POST['description'])?>',
	},
<?php
if (!$_POST['title'] and !$_POST['description']) {
?>
	type: 'error',
	error: 'The title or the description must have something!'
<?php
} else {
	$result = Gallery::create(utf8_decode($_POST['title']), utf8_decode($_POST['content']));
	if ($result) {
		$gallery = new Gallery();
		$gallery = $gallery->get_most_recent();
?>
	type: 'success',
	entry: {
		idGallery: '<?php echo $gallery->get_id(); ?>',
		title: '<?php echo $gallery->get_title(); ?>',
		content: '<?php echo $gallery->get_content(); ?>',
		slug: '<?php echo $gallery->slug; ?>',
		creationDate: '<?php echo $gallery->creationDate; ?>',
		idParent: '<?php echo $gallery->id_parent; ?>',
		type: '<?php echo $gallery->type; ?>'
	}
<?php	
	} else {
?>
	type: 'error',
	error: 'Some error ocurred'
<?php
	}
}
?>
}
<?php
exit;
?>